﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "formchangepassword.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

signals:
    //发送旧的用户名密码哈希给子窗口，用于修改密码
    void SendOldUserPassword(QString strUser, QByteArray baOldHash);

private slots:
    void on_pushButtonAddUser_clicked();

    void on_pushButtonChangePasswd_clicked();

    //手动添加的槽函数，从子窗口接收新的密码哈希值
    void RecvNewUserPassword(QString strUser, QByteArray baNewHash);

    void on_pushButtonDelUser_clicked();

private:
    Ui::MainWindow *ui;

    //更新列表控件的显示
    void UpdateListShow();

    //保存用户名和密码哈希值
    QMap<QString, QByteArray> m_mapUserAndHash;
    //子窗口对象指针
    FormChangePassword *m_pFormChild;
    //初始化设置
    void Init();
};
#endif // MAINWINDOW_H
